import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:glass_kit/glass_kit.dart';
import 'package:todo_project/base_bg.dart';
import 'package:todo_project/color.dart';
import 'package:todo_project/customer_widget/glass_title_card.dart';

class AddTask extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _AddTaskState();
}

class _AddTaskState extends State<AddTask> {
  @override
  Widget build(BuildContext context) => BgContainer(Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.transparent,
        ),
        body: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                margin: EdgeInsets.symmetric(horizontal: 20.w),
                child: GlassTitleCard(
                  child: Container(
                    child: const TextField(
                      decoration: InputDecoration(border: InputBorder.none),
                    ),
                    padding:
                        EdgeInsets.symmetric(horizontal: 12.w, vertical: 10.w),
                  ),
                  title: "标题",
                  titleActions: [
                    MaterialButton(
                      onPressed: () {},
                      materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                      child: Row(
                        children: [
                          Icon(
                            Icons.star_border,
                            color: AppColor.textColorBright,
                            size: 16.w,
                          ),
                          SizedBox(
                            width: 5.w,
                          ),
                          Text(
                            "收藏",
                            style: TextStyle(
                                color: AppColor.textColorBright,
                                fontSize: 12.sp),
                          )
                        ],
                      ),
                    )
                  ],
                ),
              ),
              SizedBox(
                height: 20.w,
              ),
              Container(
                margin: EdgeInsets.symmetric(horizontal: 20.w),
                child: GlassTitleCard(
                    child: Container(
                      child: const TextField(
                        decoration: InputDecoration(border: InputBorder.none),
                      ),
                      padding: EdgeInsets.symmetric(
                          horizontal: 12.w, vertical: 10.w),
                    ),
                    title: "开始时间"),
              ),
              SizedBox(
                height: 20.w,
              ),
              Container(
                margin: EdgeInsets.symmetric(horizontal: 20.w),
                child: GlassTitleCard(
                    child: Container(
                      child: const TextField(
                        decoration: InputDecoration(border: InputBorder.none),
                      ),
                      padding: EdgeInsets.symmetric(
                          horizontal: 12.w, vertical: 10.w),
                    ),
                    title: "执行次数"),
              ),
              SizedBox(
                height: 20.w,
              ),
              Container(
                margin: EdgeInsets.symmetric(horizontal: 20.w),
                child: GlassTitleCard(
                    child: Container(
                      child: ListView.builder(
                        itemBuilder: (ctx, index) {
                          return Container();
                        },
                        itemCount: 0,
                        shrinkWrap: true,
                        physics: const NeverScrollableScrollPhysics(),
                      ),
                      padding: EdgeInsets.symmetric(
                          horizontal: 12.w, vertical: 10.w),
                    ),
                    title: "子任务"),
              ),
            ],
          ),
        ),
        floatingActionButtonLocation:
            FloatingActionButtonLocation.miniCenterFloat,
        floatingActionButton: FloatingActionButton(
          onPressed: () {},
          backgroundColor: Colors.transparent,
          elevation: 0,
          child: GlassContainer(
            child: const Icon(Icons.assignment_turned_in_outlined),
            height: double.infinity,
            width: double.infinity,
            gradient: LinearGradient(
              colors: [
                Colors.white.withOpacity(0.60),
                Colors.white.withOpacity(0.20)
              ],
              begin: Alignment.topLeft,
              end: Alignment.bottomRight,
            ),
            borderGradient: LinearGradient(
              colors: [
                Colors.white.withOpacity(0.10),
                Colors.white.withOpacity(0.10),
                Colors.white.withOpacity(0.05),
                Colors.white.withOpacity(0.1)
              ],
              begin: Alignment.topLeft,
              end: Alignment.bottomRight,
              stops: [0.0, 0.39, 0.40, 1.0],
            ),
            blur: 20.0,
            borderWidth: 1.5,
            elevation: 3.0,
            isFrostedGlass: false,
            shadowColor: Colors.black.withOpacity(0.20),
            alignment: Alignment.center,
            frostedOpacity: 0.12,
            borderRadius: BorderRadius.circular(100),
          ),
        ),
      ));
}
